var redisManager = require('../redisManager');
var EventProxy = require('eventproxy');


(function(){
    var user = {
        _id: 1,
        openid: 'openid0001',
        name: 'lgyhitler',
        gender: 'male',
        headimg: '1.jpg',
        city: '北京',
        province: '山东',
        country: '中国',
        openid: 'otO6QjjtyxiFm8vDjJgWMaepsUwM',
        isBlock: false
    }
    /*redisManager.addAttendSet('5416501b4b7635192e9d11e1', '53fed96f2056bfa6667a6177', function(err, resp){
        console.log(err);
        console.log(resp);
        process.exit();
    })*/
    /*redisManager.delAttendSet('5416501b4b7635192e9d11e1', function(err, resp){
        console.log(err);
        console.log(resp);
        process.exit();
    })*/
    /*redisManager.getScoreList('54095afddc9b416414cc1fe9', function(err, resp){
        console.log(err);
        console.log(resp);
        process.exit();
    })*/
    /*redisManager.addScoreList('54095afddc9b416414cc1fe9', '53f1bfb4b6c264784b527c1b', 85, function(err, resp){
        console.log(err);
        console.log(resp);
        process.exit();
    })*/
    /*redisManager.addUserFriend(2, 10, {id:2}, function(err, data){
        console.log(err)
        if(data){
            console.log('add')
        }else{
            console.log('has')
        }
        process.exit()
    })*/
    /*redisManager.putUserIntoCache(user, function(err, data){
        if(err){
            console.log(err)
        }
        console.log('完成: '+data)
    })*/
    /*redisManager.getUser(user.openid, function(err, user){
        console.log(user)
        process.exit()
    })*/
    /*redisManager.updateUser(user.openid, 'headimg', 'fuck.jpg', function(err, data){
        console.log(data)
        process.exit()
    })*/
    /*var ep = new EventProxy()
    redisManager.getUserFriends(2, function(err, fids){
        if(err) return console.log(err)
        ep.after('friends', fids.length, function(flist){
            console.log(flist)
        })
        var friends = [];
        for(var i= 0, len=fids.length; i<len; i++){
            //var user = fids[i];
            (function(id){
                redisManager.getUserById(id, function(err, user){
                    ep.emit('friends', {
                        id: user.id,
                        name: user.name
                    })
                })
            })(fids[i])
        }
        //process.exit()
    })*/
})()